package zhu.areas.recruit.service;

import zhu.areas.recruit.dao.IRecruitPlanCommDAO;
import zhu.areas.recruit.dao.IRecruitYuDAO;
import zhu.areas.recruit.data.RecruitApply;
import zhu.areas.recruit.data.RecruitPlanComm;
import zhu.common.data.Pager;

public class RecruitYuServiceImpl implements IRecruitYuService {
	private IRecruitYuDAO recruitYuDAO;
	private IRecruitPlanCommDAO recruitPlanCommDAO;

	public boolean addRecruitApply(RecruitApply recruitApply) {
		// TODO Auto-generated method stub
		try{
			recruitYuDAO.save(recruitApply);
			return true;
		}catch(Exception e){
			e.printStackTrace();
		}
		return false;
	}

	public RecruitApply getByEmpoymentID(Integer empoymentID) {
		// TODO Auto-generated method stub
		return recruitYuDAO.findByEmpoymentID(empoymentID);
	}

//	public List<RecruitApply> getRecruitAppByStatue(Integer statueID) {
//		// TODO Auto-generated method stub
//		return recruitYuDAO.findByStatue(statueID);
//	}
	
	public boolean updateRecruit(RecruitApply recruitApply) {
		// TODO Auto-generated method stub
		try{
			//recruitYuDAO.update(recruitApply);
			recruitYuDAO.saveOrUpdate(recruitApply);
			return true;
		}catch(Exception e){
			e.printStackTrace();
		}	
		return false;
	}

	public boolean addRecruitPlanComm(RecruitPlanComm recruitPlanComm) {
		// TODO Auto-generated method stub
		try{
			recruitPlanCommDAO.save(recruitPlanComm);
			return true;
		}catch(Exception e){
			e.printStackTrace();
		}
		return false;
	}

	public Pager findPageRecruit(Integer statueID,Integer pageSize, String currentPage,
			String pageMethod) {
		// TODO Auto-generated method stub
		return this.recruitYuDAO.findRecruitApplyByStatue(statueID,pageSize, currentPage, pageMethod);
		//return null;
	}
	
	public IRecruitYuDAO getRecruitYuDAO() {
		return recruitYuDAO;
	}

	public void setRecruitYuDAO(IRecruitYuDAO recruitYuDAO) {
		this.recruitYuDAO = recruitYuDAO;
	}

	public IRecruitPlanCommDAO getRecruitPlanCommDAO() {
		return recruitPlanCommDAO;
	}

	public void setRecruitPlanCommDAO(IRecruitPlanCommDAO recruitPlanCommDAO) {
		this.recruitPlanCommDAO = recruitPlanCommDAO;
	}
	
}
